<!DOCTYPE html>
<html xmlns="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<base th:href="@{/}" />
<title>Insert title here</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/css/Managerstyle.css}"/>
<script th:src="@{/js/jquery-3.4.1.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
</head>
<body>
	<div class="contain">
		<h3>修改学生信息</h3>
		<div class="modify">
			<form action="mc/modifyStudent" method="post">
				<dl class="dl-horizontal">
					<dt>学号：</dt>
					<dd><input type="text" name="srollno" readonly="readonly" th:value="${student.srollno}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>姓名：</dt>
					<dd><input type="text" name="sname" th:value="${student.sname}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>所属学院：</dt>
					<dd>
						<select id="select1">
							<option>请选择学院</option>
							<option th:each="acadamy:${acadamylist}" th:value="${acadamy.acdmid}"  th:text="${acadamy.acdmname}"></option>
						</select>
					</dd>
					<br>
					<dt>所属专业：</dt>
					<dd>
						<select id="select2">
							<option>请选择专业</option>
						</select>
					</dd>
					<br>
					<dt>班级：</dt>
					<dd>
						<select id="select3" name="bid">
							<option>请选择班级</option>
						</select>
					</dd>
					<br>
					<dt>性别：</dt>
					<dd>
						<select name="sgender" >
							<option value="男">男</option>
							<option value="女 ">女</option>
						</select>
					</dd>
					<br>
					<dt>出生日期：</dt>
					<dd><input type="date" name="birthday" th:value="${student.birthday}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>密保问题：</dt>
					<dd><input type="text" name="sque" th:value="${student.sque}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>密保答案：</dt>
					<dd><input type="text" name="sans" th:value="${student.sans}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>入学年份：</dt>
					<dd><input type="date" name="enrolment" th:value="${student.enrolment}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>籍贯：</dt>
					<dd><input type="text" name="location" th:value="${student.location}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>政治面貌：</dt>
					<dd><input type="text" name="political" th:value="${student.political}" class="form-control" style="width: 250px;"></dd>
					<br>
				</dl>
				<input type="hidden" name="img" >
				<input type="submit" class="btn btn-primary" value="提 交">
			</form>
		</div>
	</div>


	<script >
		$("#select1").change(function(){
	   		$("#lpid").removeAttr("value");
	   		   var str2 = "<option>请选择专业</option>";
				var str3 = "<option>请选择班级</option>";
				$.ajax({
					url: 'mc/getMajorByacdmid',
					type: 'GET',
					data: {acdmid: $("#select1").val()},
					success: function(data){
						var str1 = "";
						$("#select2").empty();
						$("#select3").empty();
					 	$("#select2").append(str2); 
					 	$("#select3").append(str3); 
						$.each(data,function(index,value){
							str1 = "<option value='"+ value.mjid +"'>" +  value.term.tyear + value.mjname + "</option>";
							$("#select2").append(str1);
						});
					},
					error: function(req,status,error){
						$("#select2").empty();
						$("#select2").append(str2);
						$("#select3").empty();
						$("#select3").append(str3);
					}
				});
			});
			$("#select2").change(function(){
				$("#lpid").removeAttr("value");
				var str3 = "<option>请选择班级</option>";
				$.ajax({
					url: 'mc/getBatchBymjid',
					type: 'GET',
					data: {mjid: $("#select2").val()},
					success: function(data){
						var str1 = "";
						$("#select3").empty();
					 	$("#select3").append(str3); 
						$.each(data,function(index,value){
							str1 = "<option value='"+ value.bid +"'>" +  value.bname + "</option>";
							$("#select3").append(str1);
						});
					},
					error: function(req,status,error){
						$("#select3").empty();
						$("#select3").append(str3);
					}
				});
			});
	</script>
</body>
</html>